﻿//////////////////////////////////////////////////////////////////
//
// Almanac.cs
//
// Copyright (c) 2012 Dan Pike. All rights reserved
//
// Refer to license.txt for any license restrictions.
// 
using Entities.Cities;
using Entities.Factories;
using Entities.Materials;
using Entities.Transporters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Entities
{
   public class Almanac : Entity
   {
      //////////////////////////////////////////////////////////////////////////
      //
      public Almanac(World world) : base(world)
      {
         //////////////////////////////////////////////////////////////////////////
         // Create a link to ourselves from our world, as the following constructors
         // may need us
         world.almanac = this;

         //////////////////////////////////////////////////////////////////////////
         // Define the materials first. The Factories constructors require them
         // to exist, as they will link to them
         materials.Add(wood = new Wood(world));
         materials.Add(bricks = new Bricks(world));
         materials.Add(grain = new Grain(world));
         materials.Add(hemp = new Hemp(world));
         materials.Add(wool = new Wool(world));
         materials.Add(ingot = new Ingot(world));
         materials.Add(honey = new Honey(world));
         materials.Add(salt = new Salt(world));
         materials.Add(tools = new Tools(world));
         materials.Add(mead = new Mead(world));
         materials.Add(cloth = new Cloth(world));
         materials.Add(beer = new Beer(world));
         materials.Add(fish = new Fish(world));
         materials.Add(clothing = new Clothing(world));
         materials.Add(cheese = new Cheese(world));
         materials.Add(pitch = new Pitch(world));
         materials.Add(pelts = new Pelts(world));
         materials.Add(meat = new Meat(world));
         materials.Add(wine = new Wine(world));
         materials.Add(spices = new Spices(world));

         //////////////////////////////////////////////////////////////////////////
         //
         factories.Add(beekeeper = new Beekeeper(world));
         factories.Add(brewery = new Brewery(world));
         factories.Add(claypit = new Claypit(world));
         factories.Add(dairy = new Dairy(world));
         factories.Add(grainFarm = new GrainFarm(world));
         factories.Add(hempFarm = new HempFarm(world));
         factories.Add(huntingLodge = new HuntingLodge(world));
         factories.Add(meadBrewery = new MeadBrewery(world));
         factories.Add(pitchmaker = new Pitchmaker(world));
         factories.Add(saltworks = new Saltworks(world));
         factories.Add(sawmill = new Sawmill(world));
         factories.Add(sheepFarm = new SheepFarm(world));
         factories.Add(smelter = new Smelter(world));
         factories.Add(smokehouse = new Smokehouse(world));
         factories.Add(stockFarm = new StockFarm(world));
         factories.Add(tailor = new Tailor(world));
         factories.Add(toolworks = new Toolworks(world));
         factories.Add(weaver = new Weaver(world));
         factories.Add(winery = new Winery(world));

         transporters.Add(riverCog = new RiverCog(world));
         transporters.Add(hulk = new Hulk(world));
         transporters.Add(hanseaticCog = new HanseaticCog(world));
         transporters.Add(crayer = new Crayer(world));
         transporters.Add(cog = new Cog(world));
         transporters.Add(snaikka = new Snaikka(world));
         transporters.Add(caravel = new Caravel(world));

         // All of the objects are stored in one dictionary to facilitate
         // lookup-by-name
         materials.ForEach(entity => entities.Add(entity.name, entity));
         factories.ForEach(entity => entities.Add(entity.name, entity));
         transporters.ForEach(entity => entities.Add(entity.name, entity));
      }

      //////////////////////////////////////////////////////////////////////////
      // All entities, indexed by name
      public Dictionary<string, Entity> entities = new Dictionary<string, Entity>(StringComparer.CurrentCultureIgnoreCase);

      //////////////////////////////////////////////////////////////////////////
      // All of the factories
      public List<Factory> factories = new List<Factory>();
      public Beekeeper beekeeper;
      public Brewery brewery;
      public Claypit claypit;
      public Dairy dairy;
      public GrainFarm grainFarm;
      public HempFarm hempFarm;
      public HuntingLodge huntingLodge;
      public MeadBrewery meadBrewery;
      public Pitchmaker pitchmaker;
      public Saltworks saltworks;
      public Sawmill sawmill;
      public SheepFarm sheepFarm;
      public Smelter smelter;
      public Smokehouse smokehouse;
      public StockFarm stockFarm;
      public Tailor tailor;
      public Toolworks toolworks;
      public Weaver weaver;
      public Winery winery;

      //////////////////////////////////////////////////////////////////////////
      // All of the materials
      public List<Material> materials = new List<Material>();
      public Beer beer;
      public Bricks bricks;
      public Cheese cheese;
      public Cloth cloth;
      public Clothing clothing;
      public Fish fish;
      public Grain grain;
      public Hemp hemp;
      public Honey honey;
      public Ingot ingot;
      public Mead mead;
      public Meat meat;
      public Pelts pelts;
      public Pitch pitch;
      public Salt salt;
      public Spices spices;
      public Tools tools;
      public Wine wine;
      public Wood wood;
      public Wool wool;

      //////////////////////////////////////////////////////////////////////////
      // All of the transporters
      public List<Transporter> transporters = new List<Transporter>();
      public RiverCog riverCog;
      public Hulk hulk;
      public HanseaticCog hanseaticCog;
      public Crayer crayer;
      public Cog cog;
      public Snaikka snaikka;
      public Caravel caravel;
   }
}
